package com.hello.booksale.util;

import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;

public class RemoteImageUtil {
    public static InputStream getImageStream(String imgUrl)
    {
        try {
            URL url = new URL(imgUrl);
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setRequestMethod("GET");
            conn.setConnectTimeout(10 * 1000);
            conn.setReadTimeout(10 * 1000);
            return conn.getInputStream();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }


    }
}
